/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "GEOFT_RIO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Rio.findAll", query = "SELECT r FROM Rio r"),
    @NamedQuery(name = "Rio.findByRioCd", query = "SELECT r FROM Rio r WHERE r.rioCd = :rioCd"),
    @NamedQuery(name = "Rio.findByRioId", query = "SELECT r FROM Rio r WHERE r.rioId = :rioId"),
    @NamedQuery(name = "Rio.findByRioNmLigacao", query = "SELECT r FROM Rio r WHERE r.rioNmLigacao = :rioNmLigacao"),
    @NamedQuery(name = "Rio.findByRioNm", query = "SELECT r FROM Rio r WHERE r.rioNm = :rioNm"),
    @NamedQuery(name = "Rio.findByRioNmCompleto", query = "SELECT r FROM Rio r WHERE r.rioNmCompleto = :rioNmCompleto"),
    @NamedQuery(name = "Rio.findByRioDiRioKm", query = "SELECT r FROM Rio r WHERE r.rioDiRioKm = :rioDiRioKm"),
    @NamedQuery(name = "Rio.findByRioDiFozKm", query = "SELECT r FROM Rio r WHERE r.rioDiFozKm = :rioDiFozKm"),
    @NamedQuery(name = "Rio.findByRioCrLongDe", query = "SELECT r FROM Rio r WHERE r.rioCrLongDe = :rioCrLongDe"),
    @NamedQuery(name = "Rio.findByRioCrLatDe", query = "SELECT r FROM Rio r WHERE r.rioCrLatDe = :rioCrLatDe"),
    @NamedQuery(name = "Rio.findByRioCrLongPara", query = "SELECT r FROM Rio r WHERE r.rioCrLongPara = :rioCrLongPara"),
    @NamedQuery(name = "Rio.findByRioCrLatPara", query = "SELECT r FROM Rio r WHERE r.rioCrLatPara = :rioCrLatPara"),
    @NamedQuery(name = "Rio.findByRioDtAtualizacao", query = "SELECT r FROM Rio r WHERE r.rioDtAtualizacao = :rioDtAtualizacao"),
    @NamedQuery(name = "Rio.findByRioAa", query = "SELECT r FROM Rio r WHERE r.rioAa = :rioAa"),
    @NamedQuery(name = "Rio.findByRioEs", query = "SELECT r FROM Rio r WHERE r.rioEs = :rioEs"),
    @NamedQuery(name = "Rio.findByRioFo", query = "SELECT r FROM Rio r WHERE r.rioFo = :rioFo"),
    @NamedQuery(name = "Rio.findByRioGmLinha", query = "SELECT r FROM Rio r WHERE r.rioGmLinha = :rioGmLinha")})
public class Rio implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "RIO_CD")
    private Long rioCd;
    @Column(name = "RIO_ID")
    private BigInteger rioId;
    @Size(max = 255)
    @Column(name = "RIO_NM_LIGACAO")
    private String rioNmLigacao;
    @Size(max = 255)
    @Column(name = "RIO_NM")
    private String rioNm;
    @Size(max = 255)
    @Column(name = "RIO_NM_COMPLETO")
    private String rioNmCompleto;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "RIO_DI_RIO_KM")
    private BigDecimal rioDiRioKm;
    @Column(name = "RIO_DI_FOZ_KM")
    private BigDecimal rioDiFozKm;
    @Column(name = "RIO_CR_LONG_DE")
    private BigDecimal rioCrLongDe;
    @Column(name = "RIO_CR_LAT_DE")
    private BigDecimal rioCrLatDe;
    @Column(name = "RIO_CR_LONG_PARA")
    private BigDecimal rioCrLongPara;
    @Column(name = "RIO_CR_LAT_PARA")
    private BigDecimal rioCrLatPara;
    @Column(name = "RIO_DT_ATUALIZACAO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date rioDtAtualizacao;
    @Column(name = "RIO_AA")
    private Short rioAa;
    @Size(max = 255)
    @Column(name = "RIO_ES")
    private String rioEs;
    @Size(max = 255)
    @Column(name = "RIO_FO")
    private String rioFo;
    @Size(max = 4000)
    @Column(name = "RIO_GM_LINHA")
    private String rioGmLinha;
    @OneToMany(mappedBy = "uslRioCd")
    private List<UsinaLocalizacao> usinaLocalizacaoList;
    @OneToMany(mappedBy = "sbrRioCd")
    private List<SubbaciaRio> subbaciaRioList;

    /**
     *
     */
    public Rio() {
    }

    /**
     *
     * @param rioCd
     */
    public Rio(Long rioCd) {
        this.rioCd = rioCd;
    }

    /**
     *
     * @return
     */
    public Long getRioCd() {
        return rioCd;
    }

    /**
     *
     * @param rioCd
     */
    public void setRioCd(Long rioCd) {
        this.rioCd = rioCd;
    }

    /**
     *
     * @return
     */
    public BigInteger getRioId() {
        return rioId;
    }

    /**
     *
     * @param rioId
     */
    public void setRioId(BigInteger rioId) {
        this.rioId = rioId;
    }

    /**
     *
     * @return
     */
    public String getRioNmLigacao() {
        return rioNmLigacao;
    }

    /**
     *
     * @param rioNmLigacao
     */
    public void setRioNmLigacao(String rioNmLigacao) {
        this.rioNmLigacao = rioNmLigacao;
    }

    /**
     *
     * @return
     */
    public String getRioNm() {
        return rioNm;
    }

    /**
     *
     * @param rioNm
     */
    public void setRioNm(String rioNm) {
        this.rioNm = rioNm;
    }

    /**
     *
     * @return
     */
    public String getRioNmCompleto() {
        return rioNmCompleto;
    }

    /**
     *
     * @param rioNmCompleto
     */
    public void setRioNmCompleto(String rioNmCompleto) {
        this.rioNmCompleto = rioNmCompleto;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioDiRioKm() {
        return rioDiRioKm;
    }

    /**
     *
     * @param rioDiRioKm
     */
    public void setRioDiRioKm(BigDecimal rioDiRioKm) {
        this.rioDiRioKm = rioDiRioKm;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioDiFozKm() {
        return rioDiFozKm;
    }

    /**
     *
     * @param rioDiFozKm
     */
    public void setRioDiFozKm(BigDecimal rioDiFozKm) {
        this.rioDiFozKm = rioDiFozKm;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioCrLongDe() {
        return rioCrLongDe;
    }

    /**
     *
     * @param rioCrLongDe
     */
    public void setRioCrLongDe(BigDecimal rioCrLongDe) {
        this.rioCrLongDe = rioCrLongDe;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioCrLatDe() {
        return rioCrLatDe;
    }

    /**
     *
     * @param rioCrLatDe
     */
    public void setRioCrLatDe(BigDecimal rioCrLatDe) {
        this.rioCrLatDe = rioCrLatDe;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioCrLongPara() {
        return rioCrLongPara;
    }

    /**
     *
     * @param rioCrLongPara
     */
    public void setRioCrLongPara(BigDecimal rioCrLongPara) {
        this.rioCrLongPara = rioCrLongPara;
    }

    /**
     *
     * @return
     */
    public BigDecimal getRioCrLatPara() {
        return rioCrLatPara;
    }

    /**
     *
     * @param rioCrLatPara
     */
    public void setRioCrLatPara(BigDecimal rioCrLatPara) {
        this.rioCrLatPara = rioCrLatPara;
    }

    /**
     *
     * @return
     */
    public Date getRioDtAtualizacao() {
        return rioDtAtualizacao;
    }

    /**
     *
     * @param rioDtAtualizacao
     */
    public void setRioDtAtualizacao(Date rioDtAtualizacao) {
        this.rioDtAtualizacao = rioDtAtualizacao;
    }

    /**
     *
     * @return
     */
    public Short getRioAa() {
        return rioAa;
    }

    /**
     *
     * @param rioAa
     */
    public void setRioAa(Short rioAa) {
        this.rioAa = rioAa;
    }

    /**
     *
     * @return
     */
    public String getRioEs() {
        return rioEs;
    }

    /**
     *
     * @param rioEs
     */
    public void setRioEs(String rioEs) {
        this.rioEs = rioEs;
    }

    /**
     *
     * @return
     */
    public String getRioFo() {
        return rioFo;
    }

    /**
     *
     * @param rioFo
     */
    public void setRioFo(String rioFo) {
        this.rioFo = rioFo;
    }

    /**
     *
     * @return
     */
    public String getRioGmLinha() {
        return rioGmLinha;
    }

    /**
     *
     * @param rioGmLinha
     */
    public void setRioGmLinha(String rioGmLinha) {
        this.rioGmLinha = rioGmLinha;
    }

    /**
     *
     * @return
     */
    @XmlTransient
    public List<UsinaLocalizacao> getUsinaLocalizacaoList() {
        return usinaLocalizacaoList;
    }

    /**
     *
     * @param usinaLocalizacaoList
     */
    public void setUsinaLocalizacaoList(List<UsinaLocalizacao> usinaLocalizacaoList) {
        this.usinaLocalizacaoList = usinaLocalizacaoList;
    }

    /**
     *
     * @return
     */
    @XmlTransient
    public List<SubbaciaRio> getSubbaciaRioList() {
        return subbaciaRioList;
    }

    /**
     *
     * @param subbaciaRioList
     */
    public void setSubbaciaRioList(List<SubbaciaRio> subbaciaRioList) {
        this.subbaciaRioList = subbaciaRioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rioCd != null ? rioCd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rio)) {
            return false;
        }
        Rio other = (Rio) object;
        if ((this.rioCd == null && other.rioCd != null) || (this.rioCd != null && !this.rioCd.equals(other.rioCd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        if (this.rioNm != null && this.rioCd != null) {
            return this.rioNm + " (" + this.rioCd + ")";
        } else {
            return "" + this.rioCd;
        }
    }
}
